/**
 * @param {number[]} nums
 * @param {number} k
 * @return {void} Do not return anything, modify nums in-place instead.
 */
// 空间复杂度on 时间复杂度on leetcode好像需要原地修改数组
var rotate = function (nums, k) {
  const len = nums.length
  const res = new Array(len).fill(0)
  for (let i = 0; i < len; i++) {
    res[(i + k) % len] = nums[i]
  }
  return res
}
var rotate1 = function (nums, k) {
  if (k == 0) return nums

}
console.log(rotate([1, 2, 3, 4, 5, 6, 7], 3))